<template>
  <div>
    <h3 class="my-8">{{ $t('edit_resident_area') }}</h3>

    <v-card class="parameters-page-card">
      <UiFormEdition
        :model="ResidenceArea"
        go-back-route="/parameters/residence_areas"
      >
        <template #default="{ entity }">
          <UiInputText
            v-if="entity !== null"
            v-model="entity.label"
            field="label"
            :rules="rules()"
          />
        </template>
      </UiFormEdition>
    </v-card>
  </div>
</template>

<script setup lang="ts">
import { useI18n } from 'vue-i18n'
import ResidenceArea from '~/models/Billing/ResidenceArea'

const i18n = useI18n()

const rules = () => [
  (label: string | null) =>
    (label !== null && label.length > 0) || i18n.t('please_enter_a_value'),
]
</script>
